home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
language
/
pcl_src.zoo
/
kcl-mods.txt
< prev
next >
Wrap
Text File
|
1991-12-20
|
9KB
|
225 lines
If you have akcl version 604 or newer, do not make these patches.
(1) Turbo closure patch
To make the turbo closure stuff work, make the following changes to KCL.
These changes can also work for an IBCL.
The three patches in this file add two features (reflected in the
value of *features*) to your KCL or IBCL:
a feature named :TURBO-CLOSURE which increases the speed of the
code generated by FUNCALLABLE-INSTANCE-DATA-1
(previous versions of the file kcl-mods.text had this feature only),
and
a feature named :TURBO-CLOSURE-ENV-SIZE which increases the speed
of the function FUNCALLABLE-INSTANCE-P.
(This file comprises two features rather than just one to allow the
PCL system to be work in KCL systems that do not have this patch,
or that have the old version of this patch.)
The first of these patches changes the turbo_closure function to
store the size of the environment in the turbo structure.
The second of patch fixes a garbage-collector bug in which
the turbo structure was sometimes ignored, AND also adapts
the garbage-collector to conform to the change made in the
first patch. The bug has been fixed in newer versions of
AKCL, but it is still necessary to apply this patch, if the
first and third patches are applied.
The third change pushes :turbo-closure and :turbo-closure-env-size
on the *features* list so that PCL will know that turbo closures
are enabled.
Note that these changes have to be made before PCL is compiled, and a
PCL which is compiled in a KCL/IBCL with these changes can only be run
in a KCL/IBCL with these changes.
(1-1) edit the function turbo_closure in the file kcl/c/cfun.c,
change the lines
----------
turbo_closure(fun)
object fun;
{
object l;
int n;
for (n = 0, l = fun->cc.cc_env; !endp(l); n++, l = l->c.c_cdr)
;
fun->cc.cc_turbo = (object *)alloc_contblock(n*sizeof(object));
for (n = 0, l = fun->cc.cc_env; !endp(l); n++, l = l->c.c_cdr)
fun->cc.cc_turbo[n] = l;
}
----------
to
----------
turbo_closure(fun)
object fun;
{
object l,*block;
int n;
if(fun->cc.cc_turbo==NULL)
{for (n = 0, l = fun->cc.cc_env; !endp(l); n++, l = l->c.c_cdr);
block=(object *)alloc_contblock((1+n)*sizeof(object));
*block=make_fixnum(n);
fun->cc.cc_turbo = block+1; /* equivalent to &block[1] */
for (n = 0, l = fun->cc.cc_env; !endp(l); n++, l = l->c.c_cdr)
fun->cc.cc_turbo[n] = l;}
}
----------
(1-2) edit the function mark_object in the file kcl/c/gbc.c,
Find the lines following case t_cclosure: in mark_object.
If they look like the ones between the lines marked (KCL),
make the first change, but if the look like the lines marked
(AKCL), apply the second change instead, and if the file
sgbc.c exists, apply the third change to it.
(1-2-1) Change:
(KCL)----------
case t_cclosure:
mark_object(x->cc.cc_name);
mark_object(x->cc.cc_env);
mark_object(x->cc.cc_data);
if (x->cc.cc_start == NULL)
break;
if (what_to_collect == t_contiguous) {
if (get_mark_bit((int *)(x->cc.cc_start)))
break;
mark_contblock(x->cc.cc_start, x->cc.cc_size);
if (x->cc.cc_turbo != NULL) {
for (i = 0, y = x->cc.cc_env;
type_of(y) == t_cons;
i++, y = y->c.c_cdr);
mark_contblock((char *)(x->cc.cc_turbo),
i*sizeof(object));
}
}
break;
(KCL)----------
to
(KCL new)----------
case t_cclosure:
mark_object(x->cc.cc_name);
mark_object(x->cc.cc_env);
mark_object(x->cc.cc_data);
if (what_to_collect == t_contiguous)
if (x->cc.cc_turbo != NULL) {
mark_contblock((char *)(x->cc.cc_turbo-1),
(1+fix(*(x->cc.cc_turbo-1)))*sizeof(object));
}
if (x->cc.cc_start == NULL)
break;
if (what_to_collect == t_contiguous) {
if (get_mark_bit((int *)(x->cc.cc_start)))
break;
mark_contblock(x->cc.cc_start, x->cc.cc_size);
}
break;
(KCL new)----------
(1-2-2) Or, Change:
(AKCL)----------
case t_cclosure:
mark_object(x->cc.cc_name);
mark_object(x->cc.cc_env);
mark_object(x->cc.cc_data);
if (what_to_collect == t_contiguous) {
if (x->cc.cc_turbo != NULL) {
for (i = 0, y = x->cc.cc_env;
type_of(y) == t_cons;
i++, y = y->c.c_cdr);
mark_contblock((char *)(x->cc.cc_turbo),
i*sizeof(object));
}
}
break;
(AKCL)----------
To:
(AKCL new)----------
case t_cclosure:
mark_object(x->cc.cc_name);
mark_object(x->cc.cc_env);
mark_object(x->cc.cc_data);
if (what_to_collect == t_contiguous) {
if (x->cc.cc_turbo != NULL)
mark_contblock((char *)(x->cc.cc_turbo-1),
(1+fix(*(x->cc.cc_turbo-1)))*sizeof(object));
}
break;
(AKCL new)----------
(1-2-3) In sgbc.c (if it exists), Change:
(AKCL)----------
case t_cclosure:
sgc_mark_object(x->cc.cc_name);
sgc_mark_object(x->cc.cc_env);
sgc_mark_object(x->cc.cc_data);
if (what_to_collect == t_contiguous) {
if (x->cc.cc_turbo != NULL) {
for (i = 0, y = x->cc.cc_env;
type_of(y) == t_cons;
i++, y = y->c.c_cdr);
mark_contblock((char *)(x->cc.cc_turbo),
i*sizeof(object));
}
}
break;
(AKCL)----------
To:
(AKCL new)----------
case t_cclosure:
sgc_mark_object(x->cc.cc_name);
sgc_mark_object(x->cc.cc_env);
sgc_mark_object(x->cc.cc_data);
if (what_to_collect == t_contiguous) {
if (x->cc.cc_turbo != NULL)
mark_contblock((char *)(x->cc.cc_turbo-1),
(1+fix(*(x->cc.cc_turbo-1)))*sizeof(object));
}
break;
(AKCL new)----------
(1-3) edit the function init_main in the file kcl/c/main.c,
change the lines where setting the value of *features* to add a :turbo-closure
and a :turbo-closure-env-size into the list in your KCL/IBCL.
For example, in Sun4(SunOS) version of IBCL
changing the lines:
----------
make_special("*FEATURES*",
make_cons(make_ordinary("SUN4"),
make_cons(make_ordinary("SPARC"),
make_cons(make_ordinary("IEEE-FLOATING-POINT"),
make_cons(make_ordinary("UNIX"),
make_cons(make_ordinary("BSD"),
make_cons(make_ordinary("COMMON"),
make_cons(make_ordinary("IBCL"), Cnil))))))));
----------
to
----------
make_special("*FEATURES*",
make_cons(make_ordinary("SUN4"),
make_cons(make_ordinary("SPARC"),
make_cons(make_ordinary("IEEE-FLOATING-POINT"),
make_cons(make_ordinary("UNIX"),
m